<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改收款记录')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-detail-edit" th:object="${receivableAccount}">
            <input name="id" th:field="*{id}" type="hidden">
            <input name="planId" class="form-control" type="hidden" th:value="*{planId}"/>
            <input name="projectId" class="form-control" type="hidden" th:value="*{projectId}"/>
            <div class="form-group">
                <label class="col-sm-3 control-label">项目/结算名称：</label>
                <div class="col-sm-8">
                    <input name="projectName"  class="form-control" type="text" th:value="*{title}" disabled/>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">收款笔数：</label>
                <div class="col-sm-8">
                    <select name="planNumber" class="form-control m-b" th:field="*{plan.planNumber}" th:with="type=${@dict.getType('account_number')}" disabled>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{plan.planNumber}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">收款金额：</label>
                <div class="col-sm-8">
                    <input name="receiveAmount" th:field="*{receiveAmount}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">收款账号：</label>
                <div class="col-sm-8">
                    <select name="bankId"  class="form-control" th:with="type=${@customDictService.selectDictBanks()}">
                        <option value="0">无</option>
                        <option th:each="dict : ${type}" th:text="${dict.name}" th:value="${dict.id}" th:selected="${receivableAccount.bankId == dict.id}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">收款人：</label>
                <div class="col-sm-8">
                    <select name="receiverId"  class="form-control" th:with="type=${@customDictService.selectUserList()}">
                        <option value="0">无</option>
                        <option th:each="dict : ${type}" th:text="${dict.userName}" th:value="${dict.userId}" th:selected="${receivableAccount.receiverId == dict.userId}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">收款时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="receiveTime" th:value="${#dates.format(receivableAccount.receiveTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">审批状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('approve_status')}">
                        <input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}">
                        <label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">删除标志：</label>
                <div class="col-sm-8">
                    <select name="deleteFlag" class="form-control m-b" th:with="type=${@dict.getType('sys_normal_disable')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{deleteFlag}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="description" class="form-control">[[*{description}]]</textarea>
                </div>
            </div>

        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "erp/receivable/detail";
        $("#form-detail-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-detail-edit').serialize());
            }
        }

        $("input[name='receiveTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>